﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Viewer.BusinessObject.BusinessEntities;
using Ext.Net;

namespace Viewer.Code
{
    public partial class HeThongDuLieu : System.Web.UI.Page
    {
        CommonCode common = new CommonCode();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                LoadData();
            }
        }
        public void LoadData()
        {
            storeHeThongDulieu.DataSource = common.LoadDataCommonByCodeKey(common.LoaiMa);
            storeHeThongDulieu.DataBind();
        }
        [DirectMethod]
        public void ShowPopUp_TaoMoiLoaiMa()
        {
            UCTaoMoiLoaiMa.ShowPopUp();
        }
        [DirectMethod]
        public void ShowDialog(string type, string codeValue, string codeId)
        {
            if (type.Equals("Delete"))
            {
                common.DeleteCommonCode(Convert.ToInt32(codeId));
                this.LoadData();
            }
            else
            {
                UCDuLieuDetail.ShowPopUp_DuLieuDetail(type, codeValue);
            }

        }
    }
}
